package com.geeksaga.domain;

import com.geeksaga.annotation.PrintToString;
import com.geeksaga.common.util.HtmlUtil;
import com.geeksaga.common.util.Util;

/**
 * @author newbie
 * @since 0.1
 */
public class Memo extends BaseObject {

	private static final long serialVersionUID = 8564155826214056317L;
	
	@PrintToString private String sid;
	@PrintToString private String depth;
	@PrintToString private String memoType;
    @PrintToString private String targetSid;
	@PrintToString private String userSid;
	@PrintToString private String userPasswd;
	@PrintToString private String userNick;
	@PrintToString private String userIcon;
	@PrintToString private String userIp;
	@PrintToString private String userCountry;
	@PrintToString private String content;
	@PrintToString private String badCnt;
	@PrintToString private String delYn;
	@PrintToString private String registDate;
	@PrintToString private String registTime;
	@PrintToString private String registTimestamp;
    @PrintToString private String modifyDate;
	@PrintToString private String modifyTime;
	@PrintToString private String modifyTimestamp;
	
	public Memo() {
	}
	
	public Memo(String targetSid) {
		this.targetSid = targetSid;
	}
	
	@Override
	public String getAsText() {
		Object value = getValue();
		
		if(value == null)
			return "";
		else 
			return value.toString();
	}
	
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        setValue(new Memo(text));
    }
    
    public String getIndexingData() {
        StringBuilder sb = new StringBuilder();
        sb.append(getUserNick());
        sb.append("\r\n");
        sb.append(HtmlUtil.removeTag(getContent()));
        
        return sb.toString();
    }    
    
	public String getIp() {
		return Util.hideIp(userIp);
	}

	public String getSid() {
		return sid;
	}

	public void setSid(String sid) {
		this.sid = sid;
	}

	public String getDepth() {
		return depth;
	}

	public void setDepth(String depth) {
		this.depth = depth;
	}

    public String getMemoType() {
        return memoType;
    }

    public void setMemoType(String memoType) {
        this.memoType = memoType;
    }

    public String getTargetSid() {
        return targetSid;
    }

    public void setTargetSid(String targetSid) {
        this.targetSid = targetSid;
    }
    
	public String getUserSid() {
		return userSid;
	}

	public void setUserSid(String userSid) {
		this.userSid = userSid;
	}

	public String getUserPasswd() {
		return userPasswd;
	}

	public void setUserPasswd(String userPasswd) {
		this.userPasswd = userPasswd;
	}

	public String getUserNick() {
		return userNick;
	}

	public void setUserNick(String userNick) {
		this.userNick = userNick;
	}

	public String getUserIcon() {
		return userIcon;
	}

	public void setUserIcon(String userIcon) {
		this.userIcon = userIcon;
	}

	public String getUserIp() {
		return userIp;
	}

	public void setUserIp(String userIp) {
		this.userIp = userIp;
	}

	public String getUserCountry() {
		return userCountry;
	}

	public void setUserCountry(String userCountry) {
		this.userCountry = userCountry;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getBadCnt() {
		return badCnt;
	}

	public void setBadCnt(String badCnt) {
		this.badCnt = badCnt;
	}

	public String getDelYn() {
		return delYn;
	}

	public void setDelYn(String delYn) {
		this.delYn = delYn;
	}

	public String getRegistDate() {
		return registDate;
	}

	public void setRegistDate(String registDate) {
		this.registDate = registDate;
	}

	public String getRegistTime() {
		return registTime;
	}

	public void setRegistTime(String registTime) {
		this.registTime = registTime;
	}
	
    public String getRegistTimestamp() {
        return registTimestamp;
    }

    public void setRegistTimestamp(String registTimestamp) {
        this.registTimestamp = registTimestamp;
    }

	public String getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(String modifyDate) {
		this.modifyDate = modifyDate;
	}

	public String getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(String modifyTime) {
		this.modifyTime = modifyTime;
	}

    public String getModifyTimestamp() {
        return modifyTimestamp;
    }

    public void setModifyTimestamp(String modifyTimestamp) {
        this.modifyTimestamp = modifyTimestamp;
    }	
}